package org.exez.modules.visitor.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.exez.modules.visitor.entity.PushWhiteList;
import org.exez.modules.visitor.mapper.PushWhiteListMapper;
import org.exez.modules.visitor.service.IPushWhiteListService;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: 白名单推送信息
 * @Author: exez-boot
 * @Date:   2020-06-30
 * @Version: V1.0
 */
@Service
public class PushWhiteListServiceImpl extends ServiceImpl<PushWhiteListMapper, PushWhiteList> implements IPushWhiteListService {

    @Override
    public PushWhiteList getByPushWhiteListIdSave(Integer id) {
        LambdaQueryWrapper<PushWhiteList> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(PushWhiteList :: getWhiteListId,id);
        queryWrapper.eq(PushWhiteList :: getType,1);
        queryWrapper.orderByDesc(PushWhiteList :: getId);
        queryWrapper.last("limit 1");
        return baseMapper.selectOne(queryWrapper);
    }
}
